export function twoSum(nums: number[], target: number): number[] {
    const ret: number[] = [];
    const map = new Map<number, number>();

    for (let i = 0; i < nums.length; i++) {
        if (map.has(target-nums[i])) {
            ret.push(map.get(target-nums[i])!);
            ret.push(i);
            break;
        }
        map.set(nums[i], i);
    }
    return ret;
};